package MyStack;

import java.util.Stack;

public class Test {
    public static void main(String[] args) {
Stack<Integer>stack=new Stack<>();
//进栈
stack.push(1);
stack.push(2);
stack.push(3);
stack.push(4);
stack.push(5);
        System.out.println(stack);
        //出栈
        stack.pop();
        stack.pop();
        System.out.println(stack);
        //判断栈是否为空
        System.out.println(stack.empty());
        //获取栈顶元素
        System.out.println(stack.peek());
        //获取元素个数
        System.out.println(stack.size());
    }
}
